<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1,
        .box3 {
            margin: 200px auto;
            width: 400px;
            height: 300px;
            overflow: hidden;
            border-radius: 5px;
            position: relative;
        }

        .box2,
        .box4 {
            position: relative;
            width: 100%;
            height: 100%;
            animation: rotate 4s linear infinite;
        }

        .box1::after,
        .box3::after {
            content: "";
            position: absolute;
            width: calc(100% - 20px);
            height: calc(100% - 20px);
            top: 10px;
            left: 10px;
            background-color: #fff;
        }

        .box2::after,
        .box4::after {
            content: '';
            position: absolute;
            left: -50%;
            top: -50%;
            width: 200%;
            height: 200%;
            background-repeat: no-repeat;
            background-size: 50% 50%, 50% 50%;
            background-position: 0 0, 100% 0, 100% 100%, 0 100%;
            background-image: linear-gradient(#399953, #399953), linear-gradient(#fbb300, #fbb300), linear-gradient(#d53e33, #d53e33), linear-gradient(#377af5, #377af5);
        }

        .box4::after {
            background-color: #fff;
            background-size: 50% 50%;
            background-position: 0 0;
            background-image: linear-gradient(#399953, #399953);
        }

        .text {
            position: absolute;
            width: calc(100% - 20px);
            height: calc(100% - 20px);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            top: 10px;
            left: 10px;
            z-index: 10;
        }

        @keyframes rotate {
            100% {
                transform: rotate(1turn);
            }

        }
    </style>
</head>

<body>
    <div class="box1">
        <div class="box2"></div>
        <div class="text">内容写在这里</div>
    </div>
    <div class="box3">
        <div class="box4"></div>
    </div>
</body>

</html>